from course import create_app, db
from flask_script import Manager, Server
from flask_migrate import Migrate, MigrateCommand  # flask_migrate==2.7.0
from flask_cors import CORS

# 创建flask的应用对象
app = create_app("develop")
# CORS(app, resources=r'/*')

manager = Manager(app)
# manager.add_command("runserver", Server(
#     use_debugger=True,
#     use_reloader=True,
#     host='0.0.0.0'))
Migrate(app, db)

# 添加迁移脚本的命令到manager中
manager.add_command("db", MigrateCommand)

if __name__ == '__main__':
    # 执行命令
    manager.run()
